package interview.common;

public class BinaryTree {
	public BinaryTreeNode buildTree(int[] data, int start, int end) {
		if(end < start) {
			return null;
		}
		
		int mid = (start + end) / 2;
		BinaryTreeNode root = new BinaryTreeNode();
		root.setData(data[mid]);
		
		root.setLeft(buildTree(data, start, mid - 1));
		root.setRight(buildTree(data, mid + 1, end));
		
		return root;
	}
}
